/**
 * Copyright 2011-2013 brin.com
 * All rights reserved.
 * 
 * @project
 * @author Brin
 * @version 1.0
 * @data 2012-15-01
 */
package com.brin.core.common;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;

/**
 * 获取Spring容器中的Bean
 * @author Brin
 *
 */
public class SpringBeanUtil implements BeanFactoryAware {
	
	private static BeanFactory bf;
	
	public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
		bf = beanFactory;
	}
	
	public static Object getBean(String beanName) {
		
		return bf.getBean(beanName);
	}
	
	public static Object getBean(String beanName, Class<?> clazz) {
		
		return bf.getBean(beanName, clazz);
	}
}